import 'package:cached_network_image/cached_network_image.dart';
import 'package:flustars/flustars.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:magic_car/authinspcter/authdetail.dart';
import 'package:magic_car/authinspcter/submitauthcarinfo.dart';
import 'package:magic_car/jiance/b_gurateedetial.dart';
import 'package:magic_car/jiance/faultcode.dart';
import 'package:magic_car/jiance/jiance_detail.dart';
import 'package:magic_car/jiance/mileagepage.dart';
import 'package:magic_car/jiance/queryhistoryresult.dart';
import 'package:magic_car/jiance/start.dart';
import 'package:magic_car/util/HttpHelper.dart';
import 'package:magic_car/util/colors.dart';
import 'package:magic_car/util/config.dart';
import 'package:shared_preferences/shared_preferences.dart';

import 'package:toast/toast.dart';
import 'package:fluwx/fluwx.dart' as fluwxx;

class QueryOrderRecPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return new ActState();
  }
}

class ActState extends State<QueryOrderRecPage>
    with SingleTickerProviderStateMixin {
  List<Choice> _tabs = [];
  TabController mTabController;
  int mCurrentPosition = 0;
  List orders = [];
  int type = 1;
  int page = 1;
  var keyword = "";
  String status = "1";
  String handelstr = "";
  Map payorderdata;
  TextEditingController keywordcontroller = new TextEditingController();
  bool loadmore = false;
  ScrollController _scrollController = new ScrollController();
  String userrole = "0";

  @override
  @override
  Widget build(BuildContext context) {
    if (status == "1") {
      return new Scaffold(
        appBar: new AppBar(
          titleSpacing: 0,
          title: new Text(
            '查询订单',
            style: TextStyle(fontSize: Config.title_size),
          ),
          backgroundColor: Colors.white,
          elevation: 0,
          bottom: new TabBar(
            indicatorSize: TabBarIndicatorSize.label,
            indicatorColor: Colours.app_main,
            labelColor: Colours.app_main,
            unselectedLabelColor: Colors.black45,
            tabs: _tabs.map((Choice choice) {
              return new Tab(
                text: choice.title,
              );
            }).toList(),
            controller: mTabController,
          ),
        ),

        body: new TabBarView(
          children: _tabs.map((Choice choice) {
            return new Padding(
                padding: const EdgeInsets.all(0.0),
                child: new Center(
                    child: Container(
                        decoration: new BoxDecoration(
                          color: Colours.base_page_color,
                        ),
                        child: Stack(
                          children: <Widget>[
                            Align(
                              alignment: Alignment.topLeft,
                              child: SizedBox(
                                  width: double.infinity,
                                  height: 50,
                                  child: Padding(
                                      padding:
                                          new EdgeInsets.fromLTRB(15, 5, 15, 0),
                                      // padding: new EdgeInsets.all(10),
                                      child: Container(
                                          child: Row(
                                              mainAxisAlignment:
                                                  MainAxisAlignment.start,
                                              children: <Widget>[
                                            Expanded(
                                              child: new Container(
                                                child: new TextField(
                                                  controller: keywordcontroller,
                                                  onChanged: (value) {
                                                    setState(() {
                                                      keyword = value;
                                                      // keywordcontroller.text = value;
                                                    });
                                                  },
                                                  onSubmitted: (value) {
                                                    FocusScope.of(context)
                                                        .requestFocus(
                                                            FocusNode());
                                                    print(value);
                                                    //if(value=="")return;
                                                    setState(() {
                                                      keyword = value;
                                                      page = 1;
                                                      //keywordcontroller.text = keyword;
                                                      // end = false;
                                                    });
                                                    print('搜索');
                                                    loaddata();
                                                  },
                                                  // controller: _phonecontroller,
                                                  decoration:
                                                      new InputDecoration(
                                                          border:
                                                              InputBorder.none,
                                                          hintText: '车架号后四位',
                                                          prefixIcon: Icon(
                                                              Icons.search)),
                                                ),
                                                decoration: new BoxDecoration(
//背景
                                                  color: Colors.white,
                                                  //设置四周圆角 角度 这里的角度应该为 父Container height 的一半
                                                  borderRadius:
                                                      BorderRadius.all(
                                                          Radius.circular(
                                                              25.0)),
                                                  //设置四周边框
                                                  border: new Border.all(
                                                      width: 1,
                                                      color: Colors.white),
                                                ),
                                              ),
                                            ),
                                            Container(
                                              width: 20,
                                            ),
                                            InkWell(
                                              onTap: () {
                                                FocusScope.of(context)
                                                    .requestFocus(FocusNode());
                                                setState(() {
                                                  page = 1;
                                                  // end = false;
                                                });
                                                print('搜索');
                                                loaddata();
                                              },
                                              child: Text('搜索'),
                                            )
                                          ])))),
                            ),
                            Container(
                                margin: EdgeInsets.fromLTRB(15, 60, 15, 10),
                                child: Text(
                                  '维保和碰撞数据由于查询需要一定时间，如果付了费，可以等待几分钟后点击查看结果获取相关数据',
                                  style: TextStyle(
                                      fontSize: 12,
                                      color: Colours.bj_orange_o1),
                                )),
                            // Align(
                            //   alignment: Alignment.topLeft,
                            //   child:Text('维保数据由于查询需要一定时间，如果付了费，可以等待几分钟后点击查看结果获取维保数据'),

                            // ),
                            Align(
                                alignment: Alignment.bottomCenter,
                                child: Padding(
                                  padding:
                                      new EdgeInsets.fromLTRB(0, 100, 0, 10),
                                  child: new Container(
                                      child: new ListView(
                                    controller: _scrollController,
                                    children: <Widget>[buildcontent()],
                                  )),
                                  // child: new RefreshIndicator(
                                  //   onRefresh: _onRefresh,
                                  //   child: ListView.builder(
                                  //       itemCount: carlist.length,
                                  //       itemBuilder:
                                  //           (BuildContext context, int index) {
                                  //         return messageitem(carlist[index]);
                                  //       }),
                                  // )
                                )),
                          ],
                        )))
                //  new Container(
                //     child: new ListView(
                //   children: <Widget>[buildcontent()],
                // ))
                );
          }).toList(),
          controller: mTabController,
        ),
        //  new TabBarView(
        //   children: _tabs.map((Choice choice) {
        //     return new Padding(
        //         padding: const EdgeInsets.all(0.0),
        //         child: new Container(
        //             child: new ListView(
        //           controller: _scrollController,
        //           children: <Widget>[buildcontent()],
        //         )));
        //   }).toList(),
        //   controller: mTabController,
        // ),
      );
    } else {
      return new Scaffold(
        appBar: new AppBar(
          title: new Text('订单'),
          backgroundColor: Colors.white,
          elevation: 0,
        ),
        body: new Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              Text('您的账号正在审核，请耐心等待！')

              // userinfo["failreason"]!=""?
              // Padding(padding: new EdgeInsets.fromLTRB(0, 10, 0, 0),child:
              // FlatButton(onPressed: (){
              // Navigator.pushNamed(context, "exam");
              // }, child:
              // new Text(''),
              // color: Color.fromRGBO(27, 182, 251, 1),
              // ) ):new Text(''),
            ],
          ),
        ),
      );
    }
  }

// 检测是否能下单
  precheckgroup() async {
    SharedPreferences pref = await SharedPreferences.getInstance();
    Map<String, String> map = new Map();
    map["uid"] = pref.getString('uid');

    HttpHelper.post(HttpHelper.API_PrecheckGroup, (data) async {
      //loadpage.close();
      if (data != null) {
        print(data);
        //Toast.show(data["msg"], context);

        if (data["code"].toString() == "1") {
          showalert();
        } else {
          Toast.show(data["msg"], context);
        }
      }
    }, params: map);
  }

  showalert() {
    showModalBottomSheet(
        context: context,
        builder: (BuildContext context) {
          return Container(
            child: Padding(
                padding: new EdgeInsets.fromLTRB(0, 0, 0, 0),
                child: Container(
                  height: 120,
                  child: new Column(children: <Widget>[
                    // new Container(
                    //     decoration: new BoxDecoration(
                    //         border: Border(
                    //             bottom:
                    //                 BorderSide(width: 1, color: Color(0xffe5e5e5)))),
                    //     height: 50,
                    //     child: Center(
                    //         child: Text('上传图片', style: TextStyle(fontSize: 16)))),
                    new Container(
                        decoration: new BoxDecoration(
                            border: Border(
                                bottom: BorderSide(
                                    width: 1, color: Color(0xffe5e5e5)))),
                        height: 40,
                        child: new GestureDetector(
                            behavior: HitTestBehavior.opaque,
                            onTap: () async {
                              Navigator.pop(context);
                              Navigator.of(context)
                                  .push(new MaterialPageRoute(builder: (_) {
                                return new BusinessAuthStartPage(2, "0", "0");
                                // return new StartPicPage(this.oid, order_info['test_type']);
                              })).then((param) {
                                //loadOrderInfo();
                              });
                              //  Navigator.pushNamed(context, "addauthcarinfo");
                            },
                            child: Center(
                                child: Text('新建车源',
                                    style: TextStyle(
                                        fontSize: 16, color: Colors.black))))),
                    new Container(
                        decoration: new BoxDecoration(
                            border: Border(
                                bottom: BorderSide(
                                    width: 1, color: Color(0xffe5e5e5)))),
                        height: 40,
                        child: new GestureDetector(
                            behavior: HitTestBehavior.opaque,
                            onTap: () async {
                              Navigator.pop(context);
                              Navigator.pushNamed(context, "mycar");
                              // Navigator.pushNamed(
                              //     context, "imdatesubmitcarinfo");
                            },
                            child: Center(
                                child: Text('已有车源',
                                    style: TextStyle(fontSize: 16))))),
                    new Container(
                        decoration: new BoxDecoration(
                            border: Border(
                                bottom: BorderSide(
                                    width: 1, color: Color(0xffe5e5e5)))),
                        height: 40,
                        child: new GestureDetector(
                            behavior: HitTestBehavior.opaque,
                            onTap: () async {
                              Navigator.pop(context);
                              Navigator.pushNamed(
                                  context, "imdatesubmitcarinfo");
                              //  submit();
                            },
                            child: Center(
                                child: Text('快速下单',
                                    style: TextStyle(
                                        fontSize: 16, color: Colors.red))))),
                  ]),
                )),
          );
        });
  }

  loaduserinfo() async {
    // LoadingPage loadpage = new LoadingPage(context);
    // loadpage.show();
    SharedPreferences pref = await SharedPreferences.getInstance();
    Map<String, String> map = new Map();
    map["id"] = pref.getString('uid');

    HttpHelper.post(HttpHelper.API_BusinessInfo, (data) async {
      //loadpage.close();
      if (data != null) {
        print(data);
        //Toast.show(data["msg"], context);

        if (data["code"].toString() == "1") {
          if (data["info"]["avatar"].length != 0) {
            setState(() {
              // avatar = data["info"]["avatar"];
            });
          }
          // SpUtil.putObject(key, value)
          var info = data["info"];
          setState(() {
            status = info["status"].toString();
          });
        }
      }
    }, params: map);
  }

  @override
  void initState() {
    super.initState();
    fluwxx.weChatResponseEventHandler.listen((res) {
      print(res);
      if (res is fluwxx.WeChatPaymentResponse) {
        if (res.isSuccessful) {
          //支付成功
          Toast.show('支付成功，请点击查看结果', context);
          setState(() {
            page = 1;
            // type = 1;
          });
          loaddata();
        } else {
          Toast.show('支付失败', context);
        }
      }
    });
    _tabs.add(Choice(title: '全部', position: 0));
    _tabs.add(Choice(title: '待付款', position: 1));
    _tabs.add(Choice(title: '已付款', position: 2));
    _tabs.add(Choice(title: '已完成', position: 3));
    //_tabs.add(Choice(title: '已完成', position: 3));
    mTabController = new TabController(vsync: this, length: _tabs.length);
    //判断TabBar是否切换
    mTabController.addListener(() {
      if (mTabController.index == mCurrentPosition) return;
      print('滑动监听' + mTabController.index.toString());
      setState(() {
        mCurrentPosition = mTabController.index;
        // if(mTabController.index==0)type=1;
        // else type = 3;
        type = mTabController.index + 1;
        page = 1;
        keyword = "";
        keywordcontroller.text = "";
      });
      loaddata(); //滑动时加载数据
    });
    _scrollController.addListener(() {
      if (_scrollController.position.pixels ==
          _scrollController.position.maxScrollExtent) {
        loadMore();
      }
    });
    // loaduserinfo();
    loaddata();
  }

  loadMore() {
    print("触发加载更多");
    if (loadmore) {
      Toast.show("加载中...", context);
      loaddata();
    } else {
      Toast.show("无更多数据", context);
    }
  }

  //加载数据
  loaddata() async {
    // Toast.show("数据加载中...", context);
    Map<String, String> map = new Map();
    SharedPreferences pref = await SharedPreferences.getInstance();
    map["id"] = pref.getString('uid');
    var status = "all";
    if (type == 2) {
      status = "0";
    } else if (type == 3) {
      status = "1";
    } else if (type == 4) {
      status = "2";
    }
    String role = pref.getString('role');
    map["role"] = role;
    setState(() {
      userrole = role;
    });
    map["status"] = status;
    map['page'] = page.toString();
    map['keyword'] = keyword;
    print(map);
    //map["bussiness"]="1";

    HttpHelper.post(HttpHelper.API_QuerydataRecord, (data) async {
      if (data != null) {
        print(data);
        if (data["code"].toString() == "1") {
          if (page == 1) orders = [];
          Future.delayed(Duration(seconds: 1), () {
            //loadpage.close();
            orders.addAll(data["info"]);
            setState(() {
              orders = orders;
            });
          });

          if (data["info"].length == 10) {
            page++;
            setState(() {
              loadmore = true;
            });
          } else {
            setState(() {
              loadmore = false;
            });
          }
          //pref.setStringList('userinfo', data["info"]);

        }
      }
    }, params: map);
  }

  @override
  void dispose() {
    super.dispose();
    mTabController.dispose();
  }

  payorder(paytype, id) async {
    Map<String, String> map = new Map();
    SharedPreferences pref = await SharedPreferences.getInstance();
    map["uid"] = pref.getString('uid');
    map['type'] = paytype.toString();
    map['id'] = id;
    map['role'] = userrole;

    print(map);
    //map["bussiness"]="1";

    HttpHelper.post(HttpHelper.API_PayqueryOrder, (data) async {
      if (data != null) {
        print(data);
        if (data["code"].toString() == "1") {
          if (paytype == 2) {
            var payinfo = data['info'];
            print(payinfo['prepayid']['0']);
            fluwxx.payWithWeChat(
                appId: Config.wx_appid,
                partnerId: payinfo['partnerid'],
                prepayId: payinfo['prepayid']['0'],
                packageValue: payinfo['package'],
                nonceStr: payinfo['noncestr'],
                timeStamp: int.parse(payinfo['timestamp']),
                sign: payinfo['sign']);
          } else {
            Toast.show(data['msg'], context);
            setState(() {
              page = 1;
            });
            loaddata();
          }
        }else{
           Toast.show(data['msg'], context);
        }
      }
    }, params: map);
  }

  //弹出付款方式
  poppaytype(id) {
    showModalBottomSheet(
        context: context,
        builder: (BuildContext context) {
          return Container(
            height: 120,
            child: Column(
              children: [
                Container(
                  height: 40,
                  decoration: BoxDecoration(
                      border: Border(
                          bottom:
                              BorderSide(width: 1, color: Colours.base_gray))),
                  child: Center(child: Text('付款方式')),
                ),
                InkWell(
                    onTap: () {
                      if(userrole=="1") return;
                      Navigator.pop(context);
                      payorder(1, id);
                      // queryprolems(type, xsz_url, chejia.text, rechcek, 4);
                    },
                    child: Container(
                      height: 40,
                      decoration: BoxDecoration(
                          border: Border(
                              bottom: BorderSide(
                                  width: 1, color: Colours.base_gray))),
                      child: Center(
                          child: Text(
                        userrole=="1"?'套餐付费（暂不支持）': '套餐付费',
                        style: TextStyle(color:userrole=="1"?Colors.grey: Colors.red),
                      )),
                    )),
                InkWell(
                    onTap: () {
                      Navigator.pop(context);
                      payorder(2, id);
                      // queryprolems(type, xsz_url, chejia.text, rechcek, 3);
                    },
                    child: Container(
                      height: 40,
                      // decoration: BoxDecoration(
                      //   border: Border(bottom: BorderSide(
                      //     width: 1,color: Colours.base_gray
                      //   ))
                      // ),
                      child: Center(
                          child: Text(
                        '微信支付',
                        style: TextStyle(color: Colors.red),
                      )),
                    )),
              ],
            ),
          );
        });
  }

  //查询结果
  queryresult(id) async {
    Map<String, String> map = new Map();
    SharedPreferences pref = await SharedPreferences.getInstance();
    map["uid"] = pref.getString('uid');
    map["id"] = id;
    HttpHelper.post(HttpHelper.API_Requerydata, (data) async {
      if (data != null) {
        print(data);
        if (data["code"].toString() == "1") {
          var querytype = int.parse(data["info"]['query_type']);
          if (querytype == 2) {
            //历史里程
            if (data["info"].containsKey('use_url') &&
                data["info"]['use_url'].toString() == "1") {
              Navigator.of(context).push(new MaterialPageRoute(builder: (_) {
                return new QueryReusltPage(
                    data['info']['id'], data['info']['result_url']);
              }));
            } else {
              Navigator.of(context).push(new MaterialPageRoute(builder: (_) {
                return new MileAgePage(data['info']['id']);
              }));
            }
          } else if (querytype == 1) {
            //历史故障码
            if (data["info"].containsKey('use_url') &&
                data["info"]['use_url'].toString() == "1") {
              Navigator.of(context).push(new MaterialPageRoute(builder: (_) {
                return new QueryReusltPage(
                    data['info']['id'], data['info']['result_url']);
              }));
            } else {
              Navigator.of(context).push(new MaterialPageRoute(builder: (_) {
                return new FaultCodePage(data['info']['id']);
              }));
            }
          } else {
            //维保和碰撞需要异步获取结果

            Navigator.of(context).push(new MaterialPageRoute(builder: (_) {
              return new QueryReusltPage("", data['info']['result_url']);
            }));

            //  Navigator.of(context).push(new MaterialPageRoute(builder: (_) {
            //     return new QueryReusltPage(data['info']['id']);
            //   }));
          }
        } else {
          Toast.show(data['msg'], context);
        }
      }
    }, params: map);
  }

  Widget buildcontent() {
    List<Widget> tiles = [];
    Widget content;
    if (orders.length == 0) {
      tiles.add(Center(
          child: Column(
              crossAxisAlignment: CrossAxisAlignment.center,
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
            Padding(
                padding: new EdgeInsets.fromLTRB(
                    15, MediaQuery.of(context).size.height / 2 - 100, 15, 0),
                child: new Text('暂无订单数据'))
          ])));
    } else {
      for (var i = 0; i < orders.length; i++) {
        var order = orders[i];
        tiles.add(Padding(
            padding: new EdgeInsets.fromLTRB(15, 10, 15, 0),
            child: Container(
              decoration: new BoxDecoration(
                color: Colors.white,
              ),
              child: Column(
                children: <Widget>[
                  Padding(
                    padding: new EdgeInsets.fromLTRB(20, 10, 20, 10),
                    child: Row(
                      children: <Widget>[
                        Expanded(
                            flex: 1,
                            child: new Text(
                              '车架号',
                              style: TextStyle(
                                  fontSize: 12,
                                  color: Color.fromRGBO(51, 51, 51, 1)),
                            )),
                        Expanded(
                          flex: 1,
                          child: new Align(
                              alignment: Alignment.centerRight,
                              child: Container(
                                  child: new Text(
                                order["vin"],
                                style: TextStyle(
                                    color: Color.fromRGBO(153, 153, 153, 1),
                                    fontSize: 12),
                              ))),
                        )
                      ],
                    ),
                  ),
                  Padding(
                    padding: new EdgeInsets.fromLTRB(20, 10, 20, 10),
                    child: Row(
                      children: <Widget>[
                        Expanded(
                            flex: 1,
                            child: new Text(
                              '查询类型',
                              style: TextStyle(
                                  fontSize: 12,
                                  color: Color.fromRGBO(51, 51, 51, 1)),
                            )),
                        Expanded(
                          flex: 1,
                          child: new Align(
                              alignment: Alignment.centerRight,
                              child: Container(
                                  child: new Text(
                                order["query_type_str"],
                                style: TextStyle(
                                    color: Color.fromRGBO(153, 153, 153, 1),
                                    fontSize: 12),
                              ))),
                        )
                      ],
                    ),
                  ),
                  Padding(
                    padding: new EdgeInsets.fromLTRB(20, 0, 20, 10),
                    child: Row(
                      children: <Widget>[
                        Expanded(
                            flex: 1,
                            child: new Text(
                              '查询费用',
                              style: TextStyle(
                                  fontSize: 12,
                                  color: Color.fromRGBO(51, 51, 51, 1)),
                            )),
                        Expanded(
                          flex: 1,
                          child: new Align(
                              alignment: Alignment.centerRight,
                              child: Container(
                                  child: new Text(
                                order["price"],
                                style: TextStyle(
                                    color: Color.fromRGBO(251, 73, 57, 1),
                                    fontSize: 12),
                              ))),
                        )
                      ],
                    ),
                  ),
                  Padding(
                    padding: new EdgeInsets.fromLTRB(20, 0, 20, 10),
                    child: Row(
                      children: <Widget>[
                        // Expanded(
                        //     flex: 1,
                        //     child:
                        new Text(
                          '查询时间',
                          style: TextStyle(
                              fontSize: 12,
                              color: Color.fromRGBO(51, 51, 51, 1)),
                        ),
                        //),
                        Expanded(
                          child: new Align(
                              alignment: Alignment.centerRight,
                              child: Container(
                                  child: new Text(
                                order["add_time"],
                                style: TextStyle(
                                    color: Color.fromRGBO(153, 153, 153, 1),
                                    fontSize: 12),
                              ))),
                        )
                      ],
                    ),
                  ),
                  Padding(
                    padding: new EdgeInsets.fromLTRB(20, 10, 20, 10),
                    child: Align(
                        alignment: Alignment.centerRight,
                        child: new Container(
                          child: new Material(
                            //INK可以实现装饰容器
                            child: new Ink(
                              //用ink圆角矩形
                              // color: Colors.red,
                              decoration: new BoxDecoration(
                                //背景
                                color: Colors.white,
                                //设置四周圆角 角度
                                borderRadius:
                                    BorderRadius.all(Radius.circular(15.0)),
                                //设置四周边框
                                border: new Border.all(
                                  width: 1,
                                  color: Colours.app_main,
                                ),
                              ),
                              child: new InkWell(
                                  //圆角设置,给水波纹也设置同样的圆角
                                  //如果这里不设置就会出现矩形的水波纹效果
                                  borderRadius: new BorderRadius.circular(15.0),
                                  //设置点击事件回调
                                  onTap: () {
                                    if (order['handelstr'] == "查看结果") {
                                      queryresult(order['id'].toString());
                                    } else if (order['handelstr'] == "付款") {
                                      setState(() {
                                        payorderdata = order;
                                      });
                                      poppaytype(order['id'].toString());
                                    }
                                  },
                                  child: Container(
                                    //设置 child 居中
                                    alignment: Alignment(0, 0),
                                    height: 30,
                                    width: 85,
                                    child: Text(order['handelstr'],
                                        style: TextStyle(
                                          color: Colours.app_main,
                                        )),
                                  )),
                            ),
                          ),
                        )
                        // child: new RaisedButton(
                        //   child: Text('申请补考'),
                        //   onPressed: () {},
                        // ),
                        ),
                  ),
                ],
              ),
            )));
      }
    }
    content = new Column(
        children: tiles //重点在这里，因为用编辑器写Column生成的children后面会跟一个<Widget>[]，
        //此时如果我们直接把生成的tiles放在<Widget>[]中是会报一个类型不匹配的错误，把<Widget>[]删了就可以了
        );
    return content;
  }
}

Widget buttons() {
  Widget button = Container(
    margin: EdgeInsets.only(left: 40, top: 40),
    child: new Material(
      //INK可以实现装饰容器
      child: new Ink(
        //用ink圆角矩形
        // color: Colors.red,
        decoration: new BoxDecoration(
          //背景
          color: Colors.white,
          //设置四周圆角 角度
          borderRadius: BorderRadius.all(Radius.circular(25.0)),
          //设置四周边框
          border: new Border.all(width: 1, color: Colors.red),
        ),
        child: new InkWell(
            //圆角设置,给水波纹也设置同样的圆角
            //如果这里不设置就会出现矩形的水波纹效果
            borderRadius: new BorderRadius.circular(25.0),
            //设置点击事件回调
            onTap: () {},
            child: Container(
              //设置 child 居中
              alignment: Alignment(0, 0),
              height: 50,
              width: 300,
              child: Text("点击 Container 圆角边框"),
            )),
      ),
    ),
  );
  return button;
}

class Choice {
  const Choice({this.title, this.icon, this.position});
  final String title;
  final int position;
  final IconData icon;
}
